Version

WeakDictionary<TKey,TValue> Class Members

The following tables list the members exposed by WeakDictionary<TKey,TValue>.

Public Constructors
 NameDescription
Public ConstructorWeakDictionary<TKey,TValue> ConstructorOverloaded.   
Public Properties
 NameDescription
Public PropertyCountReturns the number of entries in the dictionary. Note that this will not take into account any garbage collected items - they will be included in the count.  
Public PropertyItemGets or sets the value associated with the specified key. Set will add an entry for the key if it doesn't already exist.  
Public PropertyKeysReturns the keys in the dictionary. Only keys with non-null values are returned.  
Public PropertyValuesReturns the values in the dictionary. Only values with non-null keys are returned.  
Public Methods
 NameDescription
Public MethodAddAdds an entry to the dictionary. If an entry with the specified key already exists, this method throws an exception.  
Public MethodClearRemoves all entries from the dictionary.  
Public MethodCompactRemoves entries from the dictionary where keys are no longer alive (have been garbage collected). Note that keys can get garbage collected during the process of compacting and therefore it's not guarrenteed that all the entries in the dictionary will be with live keys after this operation is completed.  
Public MethodContainsKeyReturns true if an entry with the specified key exists in the dictionary.  
Public MethodRemoveRemoves the entry with the specified key. Does nothing if the specified key doesn't exist.  
Public MethodTryGetValueGets the value associated with the specified key. If the entry doesn't exist, returns false.  
See Also